package com.atguigu.boot_redis05_cart.config;

import com.atguigu.boot_redis05_cart.intercept.CartIntercept;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web请求配置
 * @author gcq
 * @Create 2021-01-03
 */
@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    /**
     * 设置拦截器接受的请求
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 所有请求都要经过拦截器
        registry.addInterceptor(new CartIntercept()).addPathPatterns("/**");
    }

}